<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>vaeThink</title>
  {include file="../common/header"}
</head>
<body class="vae-body">

<div class="vae-content">
  <fieldset class="layui-elem-field layui-field-title" >
    <legend>短信内容配置</legend>
  </fieldset>
  <form class="layui-form layui-form-pane" action="">
    <div class="layui-form-item">
      <label class="layui-form-label">短信标题</label>
      <div class="layui-input-block">
        <input type="text" name="name" autocomplete="off" required="required" lay-verify="required"  placeholder="请输入标题" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">短信内容</label>
      <div class="layui-input-block">
        <input type="text" name="data" autocomplete="off" required="required" lay-verify="required"  placeholder="请输入标题" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">短信ID</label>
      <div class="layui-input-block">
        <input type="text" name="number" autocomplete="off" required="required" lay-verify="required"  placeholder="请输入标题" class="layui-input">
      </div>
    </div>


    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">简介</label>
      <div class="layui-input-block">
        <textarea placeholder="请输入内容" class="layui-textarea" name="remark" required ></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <button class="layui-btn" lay-submit="" lay-filter="vaeform">立即提交</button>
    </div>
  </form>
</div>






{include file="../common/footer"}

<script>
layui.config({
    base: '/themes/admin_themes/module/'
}).use(['vaeyo','form'], function(){
  var table = layui.table
  ,vae = layui.vaeyo
  ,$ = layui.$
  ,form = layui.form;

  //监听提交
  form.on('submit(vaeform)', function(data){
    $.ajax({
      url:"{:url('sms/tpAddData')}",
      type:'post',
      data:data.field,
      success:function(e){
        if(e.code==1){
          layer.confirm('保存成功,返回列表页吗?', {icon: 3, title:'提示'}, function(index){
            vae.backThisTab();
            layer.close(index);
          });
        }else{
          layer.msg(e.msg);
        }
      }
    })
    return false;
  });
  form.on('select(sms-data)',function (data) {
    console.log(data);
    var intro = $("#sms-data option:selected").attr('label');

    $(".layui-word-aux:last").html(intro);
  })
});
</script>

</body>
</html>